package lambda;

/**
 * @author: wh(1835734390 @ qq.com)
 * @date: 2023/2/22 13:50
 * @description:
 * @version:
 */
public class LambdaDemo {
    public static void main(String[] args) {
        //通过表达式定义接口的实例
        IEncoder encoder = (num) -> {
            return num + 1;
        };
        int result = encoder.encode(1);
        System.out.println("加密结果" + result);
        System.out.println("--------------------------------------------------");
        IEncoder encoder2 = num ->num + 1;
        int result2 = encoder2.encode(1);
        System.out.println("加密结果" + result2);
    }
}
